package com.sky.controller.admin;

import com.sky.constant.StatusConstant;
import com.sky.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/admin/shop")
@RestController("adminshopController")
public class ShopController {
    @Autowired
    private RedisTemplate redisTemplate;


    @PutMapping("/{status}")
    public Result setShopStatus(@PathVariable Integer status){
        redisTemplate.opsForValue().set(StatusConstant.SHOP_STATUS,status);
        return Result.success();
    }
    @GetMapping("/status")
    public Result getShopStatus(){
        Integer o = (Integer)redisTemplate.opsForValue().get(StatusConstant.SHOP_STATUS);
       return Result.success(o);
    }

}
